<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 输入年月,输出月份的最大天数(月份在1-12之间,输入错误要重输)
        do {
            var year = +prompt(`请输入年份`)
            var month = +prompt(`请输入月份`)
            if (year % 100 == 0 && year % 4 == 0 || year % 400 == 0) {
                if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
                    alert(`31天`)
                } else if (month == 2) {
                    alert(`29天`)
                } else if (month < 1 || month > 12) {
                    alert(`请重新输入`)
                } else {
                    alert(`30天`)
                }
            } else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
                alert(`31天`)
            } else if (month == 2) {
                alert(`28天`)
            } else if (month < 1 || month > 12) {
                alert(`请重新输入`)
            } else {
                alert(`30天`)
            }
        } while (true)
    </script>
</head>

<body>

</body>

</html>